package com.dongdong.service.impl;


import com.dongdong.mapper.TbAdminMapper;
import com.dongdong.model.TbAdmin;
import com.dongdong.model.TbAdminExample;
import com.dongdong.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.dongdong.service.AdminService;

import java.util.List;


@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private TbAdminMapper adminMapper;

    @Override
    public TbAdmin getAdminByName(String username) {
        TbAdminExample example = new TbAdminExample();
        example.createCriteria().andPnameEqualTo(username);
        List<TbAdmin> tbAdmins = adminMapper.selectByExample(example);
        return (tbAdmins != null && tbAdmins.size() > 0) ? tbAdmins.get(0) : null;
    }
}
